<template>
    <div class="card_wrap">
        <div class="title" v-if="item.title">{{ item.title }}</div>
        <div class="content_wrap">
            <img :src="item.img" alt="">
            <div :class="`overlay ${item.overlay ? '' : 'hide'}`">
                <div class="footer_title" v-if="item.footerTitle" :style="item.footerStyle">{{ item.footerTitle }}</div>
                <div class="center_title" v-if="item.centerTitle" :style="item.centerStyle">{{ item.centerTitle }}</div>
            </div>
        </div>
        <div class="more" @click="moreStatus = !moreStatus">展开详情<img class="icon" src="@/assets/images/icon.jpg" ></div>
        <c-card-more :class="`c-card-more ${item.more && moreStatus ? 'active' : ''}`" :type="item.more" @close="moreStatus = false" :moreStatus="moreStatus"/>
    </div>
</template>
<script>
export default {
    props: {
        item: {
            type: Object,
            default: () => {
                return {}
            }
        }
    },
    data () {
        return {
            moreStatus: false
        }
    }
}
</script>
<style lang="less" scoped>
.card_wrap{
    width: 100%;
    background: #000;
    .title{
        font-size: 0.28rem;
        color: #ffffff;
        text-align: center;
        height: 0.7rem;
        line-height: 0.7rem;
    }
    .content_wrap{
        position: relative;
        // height: 3.2rem;
        img{
            width: 6.9rem;
            display: block;
        }
        .overlay{
            width: 100%;
            height: 100%;
            position: absolute;
            top: 0;
            left: 0;
            // background: rgba(0, 0, 0, 0.5);
            background-image: linear-gradient(0deg, rgba(0, 0, 0, 1), rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0));
            display: flex;
            align-items: flex-end;
            &.hide{
                background: rgba(0, 0, 0, 0);
            }
            .footer_title{
                width: 100%;
                font-size: 0.26rem;
                line-height: 0.32rem;
                color: #fff;
                padding: 0 0.55rem 0.2rem;
                box-sizing: border-box;
                background-image: linear-gradient(0deg, rgba(0,0,0,.5), rgba(0,0,0,0));
            }
            .center_title{
                font-size: 0.36rem;
                color: #fff;
                width: 100%;
                position: absolute;
                text-align: center;
                left: 0;
                top: 1.25rem;
            }
        }
    }
    .more{
        height: 0.84rem;
        background-color: #fff;
        font-size: 0.24rem;
        display: flex;
        align-items: center;
        justify-content: center;
        color: #000;
        .icon{
            width: 0.25rem;
            height: 0.25rem;
            margin-left: 0.14rem;
        }
    }
    .c-card-more{
        transition: max-height ease-in .5s;
        overflow: hidden;
        max-height: 0;
        &.active{
            content:'';
            max-height: 28rem;
        }
    }
}
</style>
